package com.mym.demo;

/**
 * @author miao
 * @version 1.0
 * @date 2025/4/10 16:50
 * @description
 */
public class Test2 {
    public static void main(String[] args) {
        Person[] people = new Person[2];
        Woman woman = new Woman();
        Man man = new Man();
        people[0]=woman;
        people[1]=man;
        for (int i = 0; i < people.length; i++) {
            people[i].pee();

        }
    }
}
abstract class Person{
    public abstract void pee();
}
class Woman extends Person{

    @Override
    public void pee() {
        System.out.println("坐着尿");
    }
}
class Man extends Person{

    @Override
    public void pee() {
        System.out.println("站着上尿");
    }
}
